package com.example.idachuappone.cook.item;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import android.annotation.SuppressLint;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.view.WindowManager.LayoutParams;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import cn.sharesdk.framework.Platform;
import cn.sharesdk.framework.Platform.ShareParams;
import cn.sharesdk.framework.PlatformActionListener;
import cn.sharesdk.framework.ShareSDK;
import cn.sharesdk.sina.weibo.SinaWeibo;
import cn.sharesdk.tencent.qzone.QZone;
import cn.sharesdk.wechat.friends.Wechat;
import cn.sharesdk.wechat.moments.WechatMoments;

import com.example.idachuappone.BaseActivity;
import com.example.idachuappone.R;
import com.example.idachuappone.cook.entity.CookResult;
import com.example.idachuappone.index.adapter.CommentAdapter;
import com.example.idachuappone.index.dto.CookDto;
import com.example.idachuappone.index.entity.Comment;
import com.example.idachuappone.index.item.CommentListActivity;
import com.example.idachuappone.index.item.CookGreensListActivity;
import com.example.idachuappone.index.item.TwoMenuGreedListActivity;
import com.example.idachuappone.index.ui.MyListView;
import com.example.idachuappone.person.item.LoginActivity;
import com.example.idachuappone.utils.AppShareData;
import com.example.idachuappone.utils.BitmapUtilHelper;
import com.example.idachuappone.utils.CheckUtil;
import com.example.idachuappone.utils.ComUtil;
import com.example.idachuappone.utils.Constant;
import com.example.idachuappone.utils.MainToast;
import com.example.idachuappone.utils.NetUtil;
import com.example.idachuappone.utils.PrefUtil;
import com.example.idachuappone.utils.Utils;
import com.lidroid.xutils.BitmapUtils;
import com.lidroid.xutils.bitmap.BitmapDisplayConfig;
import com.lidroid.xutils.bitmap.BitmapGlobalConfig.BitmapCacheManagementTask;
import com.lidroid.xutils.bitmap.callback.BitmapLoadCallBack;
import com.lidroid.xutils.bitmap.callback.BitmapLoadFrom;
import com.lidroid.xutils.exception.HttpException;
import com.lidroid.xutils.http.ResponseInfo;
import com.lidroid.xutils.http.callback.RequestCallBack;

@SuppressLint({ "NewApi" })
public class CookDetailActivity extends BaseActivity implements OnClickListener {
	private int LoginRequest;
	private Button btn_back;
	private Button btn_comment_all;
	private Button btn_promptly_submit;
	private Button btn_share;
	private BitmapUtils bu;
	private CommentAdapter commentAdapter;
	private CookResult cookResult;
	private Dialog dialogLoading;
	private Dialog dialogShare;
	private Handler handler;
	private Dialog headCookDialog;
	private String id;
	private ImageView img_collect;
	private ImageView img_cook_head;
	private ImageView img_star;
	private ImageView img_tu1;
	private ImageView img_tu2;
	private LinearLayout ll_comment_1;
	private LinearLayout ll_cook2_content;
	private MyListView lv_comment;
	private PlatformActionListener paListener;
	private TextView tv_bespeak_num;
	private TextView tv_comment_num;
	private TextView tv_greed;
	private TextView tv_menu_cook_greeed_all;
	private TextView tv_menu_num;
	private TextView tv_name;
	private TextView tv_service_for;

	class AnonymousClass_10 extends BitmapLoadCallBack<View> {
		private final/* synthetic */RelativeLayout val$rLayout_head_dialog_progress;

		AnonymousClass_10(RelativeLayout relativeLayout) {
			this.val$rLayout_head_dialog_progress = relativeLayout;
		}

		@Override
		public void onLoadCompleted(View view, String arg1, Bitmap bitmap, BitmapDisplayConfig arg3, BitmapLoadFrom arg4) {
			this.val$rLayout_head_dialog_progress.setVisibility(BitmapCacheManagementTask.MESSAGE_CLEAR_MEMORY_BY_KEY);
			((ImageView) view).setImageBitmap(bitmap);
		}

		@Override
		public void onLoadFailed(View arg0, String arg1, Drawable arg2) {
		}
	}

	public CookDetailActivity() {
		this.LoginRequest = 15;
		this.handler = new Handler() {
			@Override
			public void handleMessage(Message msg) {
				switch (msg.what) {
				case 111 /* 111 */:
					MainToast.show(CookDetailActivity.this, "\u5206\u4eab\u5931\u8d25", 0);
				case 11111:
					MainToast.show(CookDetailActivity.this, "\u5206\u4eab\u53d6\u6d88", 0);
				default:
				}
			}
		};
		this.paListener = new PlatformActionListener() {
			@Override
			public void onError(Platform platform, int action, Throwable t) {
				CookDetailActivity.this.handler.sendEmptyMessage(111);
			}

			@Override
			public void onComplete(Platform arg0, int arg1, HashMap<String, Object> hashMap) {
				CookDetailActivity.this.handler.sendEmptyMessage(1111);
			}

			@Override
			public void onCancel(Platform platform, int action) {
				CookDetailActivity.this.handler.sendEmptyMessage(11111);
			}
		};
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_cook_detail_two);
		ShareSDK.initSDK(this);
		this.bu = BitmapUtilHelper.createBitmapUtil(this);
		this.dialogLoading = ComUtil.createCusProgressSmallBlackBgDialog(this);
		this.id = getIntent().getStringExtra("id");
		initView();
		checkNet();
	}

	private void checkNet() {
		if (CheckUtil.checkNet(this)) {
			initCookResult();
		} else {
			MainToast.show(this, getResources().getString(R.string.txt_network), 0);
		}
	}

	private void initCookResult() {
		this.dialogLoading.show();
		NetUtil.get(this, new StringBuilder(Constant.COOK_ID).append(this.id).toString(), 100,
				new RequestCallBack<String>() {
					@Override
					public void onSuccess(ResponseInfo<String> responseInfo) {
						CookDetailActivity.this.dialogLoading.dismiss();
						String json = NetUtil.unescapeUnicode(responseInfo.result);
						CookDto cookDto = new CookDto();
						try {
							CookDetailActivity.this.btn_promptly_submit.setEnabled(true);
							CookDetailActivity.this.cookResult = cookDto.getCookResult(CookDetailActivity.this, json);
							CookDetailActivity.this.setViewData();
						} catch (Exception e) {
							MainToast.show(CookDetailActivity.this, e.getMessage(), 0);
						}
					}

					@Override
					public void onFailure(HttpException arg0, String arg1) {
						NetUtil.netFail(CookDetailActivity.this, CookDetailActivity.this.dialogLoading, true);
					}
				});
	}

	private void initComment() {
		if (this.cookResult.getComment() != null) {
			this.ll_comment_1.setVisibility(0);
			List<Comment> list = new ArrayList();
			list.add(this.cookResult.getComment());
			initAdapter(list);
			return;
		}
		this.ll_comment_1.setVisibility(BitmapCacheManagementTask.MESSAGE_CLEAR_MEMORY_BY_KEY);
	}

	private void initView() {
		this.btn_back = (Button) findViewById(R.id.btn_back);
		this.btn_back.setOnClickListener(this);
		this.btn_share = (Button) findViewById(R.id.btn_share);
		this.btn_share.setOnClickListener(this);
		this.img_collect = (ImageView) findViewById(R.id.img_collect);
		this.img_collect.setOnClickListener(this);
		this.btn_comment_all = (Button) findViewById(R.id.btn_comment_all);
		this.btn_comment_all.setOnClickListener(this);
		this.ll_comment_1 = (LinearLayout) findViewById(R.id.ll_comment_1);
		this.ll_comment_1.setOnClickListener(this);
		((ScrollView) findViewById(R.id.scrollView1)).smoothScrollTo(0, 0);// .ERROR_INVALID_SpeechErrorDATA);
		this.lv_comment = (MyListView) findViewById(R.id.lv_comment);
		this.commentAdapter = new CommentAdapter(this, BitmapUtilHelper.createBitmapUtil(this));
		this.lv_comment.setAdapter(this.commentAdapter);
		this.lv_comment.setFocusable(false);
		this.tv_greed = (TextView) findViewById(R.id.tv_greed);
		this.tv_name = (TextView) findViewById(R.id.tv_name);
		this.img_star = (ImageView) findViewById(R.id.img_star);
		this.tv_bespeak_num = (TextView) findViewById(R.id.tv_bespeak_num);
		this.tv_service_for = (TextView) findViewById(R.id.tv_service_for);
		this.tv_menu_num = (TextView) findViewById(R.id.tv_menu_num);
		this.img_cook_head = (ImageView) findViewById(R.id.img_cook_head);
		this.img_cook_head.setOnClickListener(this);
		this.btn_promptly_submit = (Button) findViewById(R.id.btn_promptly_submit);
		this.btn_promptly_submit.setOnClickListener(this);
		this.ll_cook2_content = (LinearLayout) findViewById(R.id.ll_cook2_content);
		this.img_tu1 = (ImageView) findViewById(R.id.img_tu1);
		this.img_tu1.setOnClickListener(this);
		this.img_tu2 = (ImageView) findViewById(R.id.img_tu2);
		this.img_tu2.setOnClickListener(this);
		this.tv_menu_cook_greeed_all = (TextView) findViewById(R.id.tv_menu_cook_greeed_all);
		this.tv_menu_cook_greeed_all.setOnClickListener(this);
		this.tv_comment_num = (TextView) findViewById(R.id.tv_comment_num);
	}

	private void initAdapter(List<Comment> list) {
		this.commentAdapter.setList(list);
		this.commentAdapter.notifyDataSetChanged();
	}

	private String getWeekStr(int week) {
		String str = "";
		switch (week) {
		case 1 /* 1 */:
			return "\u5468\u4e00";
		case BitmapCacheManagementTask.MESSAGE_FLUSH /* 2 */:
			return "\u5468\u4e8c";
		case BitmapCacheManagementTask.MESSAGE_CLOSE /* 3 */:
			return "\u5468\u4e09";
		case BitmapCacheManagementTask.MESSAGE_CLEAR /* 4 */:
			return "\u5468\u56db";
		case BitmapCacheManagementTask.MESSAGE_CLEAR_MEMORY /* 5 */:
			return "\u5468\u4e94";
		case BitmapCacheManagementTask.MESSAGE_CLEAR_DISK /* 6 */:
			return "\u5468\u516d";
		case BitmapCacheManagementTask.MESSAGE_CLEAR_BY_KEY /* 7 */:
			return "\u5468\u65e5";
		default:
			return str;
		}
	}

	private void setViewData() {
		int i;
		if (this.cookResult.getWorkday() != null) {
			for (i = 0; i < this.cookResult.getWorkday().size(); i++) {
				View view = LinearLayout.inflate(this, R.layout.simple_cook_detail_time, null);
				TextView tv_name = (TextView) view.findViewById(R.id.tv_detail_name);
				TextView tv_time = (TextView) view.findViewById(R.id.tv_detail_time);
				if (this.cookResult.getWorkday().get(i).getWeekday() <= 7) {
					tv_name.setText(getWeekStr(this.cookResult.getWorkday().get(i).getWeekday()) + "\uff1a");
					tv_time.setText(new StringBuilder(String.valueOf(this.cookResult.getWorkday().get(i).getFrom()))
							.append(":00-").append(this.cookResult.getWorkday().get(i).getTo()).append(":00")
							.toString());
				}
				if (this.cookResult.getWorkday().get(i).getWeekday() == 11) {
					tv_name.setText("\u5de5\u4f5c\u65e5\uff1a");
					tv_time.setText(new StringBuilder(String.valueOf(this.cookResult.getWorkday().get(i).getFrom()))
							.append(":00-").append(this.cookResult.getWorkday().get(i).getTo()).append(":00")
							.toString());
				}
				if (this.cookResult.getWorkday().get(i).getWeekday() == 12) {
					tv_name.setText("\u5468\u672b\uff1a");
					tv_time.setText(new StringBuilder(String.valueOf(this.cookResult.getWorkday().get(i).getFrom()))
							.append(":00-").append(this.cookResult.getWorkday().get(i).getTo()).append(":00")
							.toString());
				}
				this.ll_cook2_content.addView(view);
			}
		}
		if (this.cookResult.getTags() == null || this.cookResult.getTags().size() <= 0) {
			this.tv_greed.setText("\u5bb6\u5e38\u83dc");
		} else {
			String tag = "";
			for (i = 0; i < this.cookResult.getTags().size(); i++) {
				tag = new StringBuilder(String.valueOf(tag)).append(this.cookResult.getTags().get(i).getName())
						.append("\u3001").toString();
			}
			this.tv_greed.setText(tag.substring(0, tag.length() - 1));
		}
		this.bu.display(this.img_cook_head, this.cookResult.getHead_small(), new BitmapLoadCallBack<View>() {
			@Override
			public void onLoadCompleted(View view, String arg1, Bitmap bitmap, BitmapDisplayConfig arg3,
					BitmapLoadFrom arg4) {
				((ImageView) view).setImageBitmap(BitmapUtilHelper.getCroppedRoundBitmap(bitmap,
						Utils.dip2px(CookDetailActivity.this, 23.0f)));
			}

			@Override
			public void onLoadFailed(View arg0, String arg1, Drawable arg2) {
			}
		});
		if (this.cookResult.getIs_favorite() == 1) {
			this.img_collect.setImageResource(R.drawable.icon_collection_p);
		} else {
			this.img_collect.setImageResource(R.drawable.icon_collection);
		}
		if (this.cookResult.getRecipe() != null && this.cookResult.getRecipe().size() >= 2) {
			this.img_tu1.setVisibility(0);
			this.img_tu2.setVisibility(0);
			setImageBac(this.img_tu1, this.cookResult.getRecipe().get(0).getImg_small());
			setImageBac(this.img_tu2, this.cookResult.getRecipe().get(1).getImg_small());
		} else if (this.cookResult.getRecipe() == null || this.cookResult.getRecipe().size() != 1) {
			this.img_tu1.setVisibility(BitmapCacheManagementTask.MESSAGE_CLEAR_MEMORY_BY_KEY);
			this.img_tu2.setVisibility(BitmapCacheManagementTask.MESSAGE_CLEAR_MEMORY_BY_KEY);
		} else {
			this.img_tu1.setVisibility(0);
			this.img_tu2.setVisibility(BitmapCacheManagementTask.MESSAGE_CLEAR_MEMORY_BY_KEY);
			setImageBac(this.img_tu1, this.cookResult.getRecipe().get(0).getImg_small());
		}
		this.tv_menu_num.setText("\u7279\u8272\u83dc(" + this.cookResult.getRecipe().size() + ")");
		if (this.cookResult.getRecipe().size() > 2) {
			this.tv_menu_cook_greeed_all.setVisibility(0);
		} else {
			this.tv_menu_cook_greeed_all.setVisibility(BitmapCacheManagementTask.MESSAGE_CLEAR_MEMORY_BY_KEY);
		}
		this.tv_service_for.setText(this.cookResult.getService_for());
		this.tv_bespeak_num.setText(this.cookResult.getBespeak_num());
		this.tv_name.setText(this.cookResult.getName());
		this.commentAdapter.setTitle(this.cookResult.getName());
		if (Double.valueOf(this.cookResult.getStar()).doubleValue() > 4.0d) {
			this.img_star.setBackgroundResource(R.drawable.icon_star05);
		} else if (Double.valueOf(this.cookResult.getStar()).doubleValue() > 3.0d) {
			this.img_star.setBackgroundResource(R.drawable.icon_star04);
		} else if (Double.valueOf(this.cookResult.getStar()).doubleValue() > 2.0d) {
			this.img_star.setBackgroundResource(R.drawable.icon_star03);
		} else if (Double.valueOf(this.cookResult.getStar()).doubleValue() > 1.0d) {
			this.img_star.setBackgroundResource(R.drawable.icon_star02);
		} else {
			this.img_star.setBackgroundResource(R.drawable.icon_star01);
		}
		this.tv_comment_num.setText("\u670d\u52a1\u8bc4\u4ef7(" + this.cookResult.getComment_num() + ")");
		if (this.cookResult.getComment_num() > 2) {
			this.ll_comment_1.setVisibility(0);
			this.btn_comment_all.setVisibility(0);
			netWorkComment();
		} else if (this.cookResult.getComment_num() > 1) {
			this.ll_comment_1.setVisibility(0);
			this.btn_comment_all.setVisibility(BitmapCacheManagementTask.MESSAGE_CLEAR_MEMORY_BY_KEY);
			netWorkComment();
		} else {
			initComment();
			this.btn_comment_all.setVisibility(BitmapCacheManagementTask.MESSAGE_CLEAR_MEMORY_BY_KEY);
		}
	}

	private void netWorkComment() {
		NetUtil.get(this, new StringBuilder(Constant.COMMENT).append(this.cookResult.getId()).append("?page=1")
				.toString(), 100, new RequestCallBack<String>() {
			@Override
			public void onSuccess(ResponseInfo<String> responseInfo) {
				int size = BitmapCacheManagementTask.MESSAGE_FLUSH;
				try {
					JSONObject jsonObject = new JSONObject(responseInfo.result);
					if (jsonObject.getInt("code") == 10000) {
						JSONArray jsonArray = jsonObject.optJSONObject("data").getJSONArray("results");
						List<Comment> list = new ArrayList();
						if (jsonArray.length() <= 2) {
							size = jsonArray.length();
						}
						for (int i = 0; i < size; i++) {
							try {
								list.add(new Comment().parseJson(jsonArray.getJSONObject(i)));
							} catch (JSONException e) {
								e.printStackTrace();
							}
						}
						CookDetailActivity.this.initAdapter(list);
						return;
					}
					MainToast.show(CookDetailActivity.this, jsonObject.getString("error"), 0);
				} catch (JSONException e2) {
					e2.printStackTrace();
				}
			}

			@Override
			public void onFailure(HttpException arg0, String arg1) {
				MainToast.show(CookDetailActivity.this,
						CookDetailActivity.this.getResources().getString(R.string.netFail), 0);
			}
		});
	}

	private void setImageBac(ImageView img, String path) {
		this.bu.display(img, path, new BitmapLoadCallBack<View>() {
			@Override
			public void onLoadCompleted(View view, String arg1, Bitmap bitmap, BitmapDisplayConfig arg3,
					BitmapLoadFrom arg4) {
				((ImageView) view).setImageBitmap(BitmapUtilHelper.toRoundCorner(bitmap,
						BitmapCacheManagementTask.MESSAGE_CLEAR_MEMORY_BY_KEY));
			}

			@Override
			public void onLoadFailed(View arg0, String arg1, Drawable arg2) {
			}
		});
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.btn_back /* 2131165198 */:
			finish();
		case R.id.btn_share /* 2131165240 */:
			this.dialogShare = createBottomShareDialog();
			this.dialogShare.show();
		case R.id.img_collect /* 2131165241 */:
			String uid = PrefUtil.getInstance(this).getUID();
			if (uid == null || uid.trim().length() <= 0) {
				showLogin();
			} else if (this.cookResult.getIs_favorite() == 1) {
				HashMap map = new HashMap();
				map.put("id", this.cookResult.getId());
				NetUtil.post(this, Constant.DELETE_COLLECT, map, new RequestCallBack<String>() {
					@Override
					public void onSuccess(ResponseInfo<String> responseInfo) {
						CookDetailActivity.this.img_collect.setImageResource(R.drawable.icon_collection);
						CookDetailActivity.this.cookResult.setIs_favorite(0);
						AppShareData.isRefreshCollect = true;
						MainToast.show(CookDetailActivity.this, "\u53d6\u6d88\u6536\u85cf", 0);
					}

					@Override
					public void onFailure(HttpException arg0, String arg1) {
						MainToast.show(CookDetailActivity.this,
								CookDetailActivity.this.getResources().getString(R.string.netFail), 0);
					}
				});
			} else {
				HashMap map = new HashMap();
				map.put("id", this.cookResult.getId());
				NetUtil.post(this, Constant.ADD_COLLECT, map, new RequestCallBack<String>() {
					@Override
					public void onSuccess(ResponseInfo<String> responseInfo) {
						CookDetailActivity.this.img_collect.setImageResource(R.drawable.icon_collection_p);
						CookDetailActivity.this.cookResult.setIs_favorite(1);
						AppShareData.isRefreshCollect = true;
						MainToast.show(CookDetailActivity.this, "\u6536\u85cf\u6210\u529f", 0);
					}

					@Override
					public void onFailure(HttpException arg0, String arg1) {
						MainToast.show(CookDetailActivity.this,
								CookDetailActivity.this.getResources().getString(R.string.netFail), 0);
					}
				});
			}
		case R.id.img_cook_head /* 2131165242 */:
			this.headCookDialog = createCookHeadDialog(this);
			if (this.headCookDialog != null) {
				this.headCookDialog.show();
			}
		case R.id.tv_menu_cook_greeed_all /* 2131165249 */:
			Intent intent2 = new Intent(this, TwoMenuGreedListActivity.class);
			Bundle bundle2 = new Bundle();
			bundle2.putSerializable("list", (Serializable) this.cookResult.getRecipe());
			intent2.putExtras(bundle2);
			startActivity(intent2);
		case R.id.img_tu1 /* 2131165250 */:
			if (this.cookResult != null && this.cookResult.getRecipe() != null) {
				Intent intent = new Intent(this, CookGreensListActivity.class);
				Bundle bundle = new Bundle();
				bundle.putInt("index", 0);
				bundle.putSerializable("recipe", (Serializable) this.cookResult.getRecipe());
				intent.putExtras(bundle);
				startActivity(intent);
			}
		case R.id.img_tu2 /* 2131165251 */:
			if (this.cookResult != null && this.cookResult.getRecipe() != null) {
				Intent intent1 = new Intent(this, CookGreensListActivity.class);
				Bundle bundle1 = new Bundle();
				bundle1.putInt("index", 1);
				bundle1.putSerializable("recipe", (Serializable) this.cookResult.getRecipe());
				intent1.putExtras(bundle1);
				startActivity(intent1);
			}
		case R.id.btn_comment_all /* 2131165256 */:
			Intent intent3 = new Intent(this, CommentListActivity.class);
			intent3.putExtra("title", this.cookResult.getName());
			intent3.putExtra("id", this.cookResult.getId());
			startActivity(intent3);
			break;
		case R.id.btn_promptly_submit /* 2131165257 */:
			if (this.cookResult == null || this.cookResult.getWork_day() == null) {
				MainToast
						.show(this,
								"\u8be5\u53a8\u5e08\u9884\u7ea6\u5df2\u6ee1\uff0c\u8bf7\u9009\u62e9\u5176\u4ed6\u53a8\u5e08",
								0);
				return;
			}
			Intent intentpro = new Intent(this, CookPromptlyActivity.class);
			Bundle bundlepro = new Bundle();
			bundlepro.putSerializable("cookDetail", this.cookResult);
			intentpro.putExtras(bundlepro);
			startActivity(intentpro);
			break;
		case R.id.ll_dismiss /* 2131165441 */:
		case R.id.txt_share_sel_cancel /* 2131165630 */:
			this.dialogShare.dismiss();
		case R.id.lLayout_share_to_weixin /* 2131165622 */:
			if (this.cookResult != null) {
				this.dialogShare.dismiss();
				ShareParams spweixin = new SinaWeibo.ShareParams();
				spweixin.setTitle("\u7231\u5927\u53a8\u53a8\u5e08" + this.cookResult.getName());
				spweixin.setText("\u5168\u57ce\u70ed\u7ea6\uff0c\u79c1\u53a8\u4e0a\u95e8\u505a\u996d\uff0169\u5143\u7ea6\u4e2a\u79c1\u53a8\u4e0a\u95e8\u505a\u996d\uff0c\u7a9d\u5728\u6c99\u53d1\u4e0a\u770b\u5b8c\u7535\u89c6\uff0c\u7f8e\u5473\u4f73\u80b4\u5c31\u4e0a\u684c\u5566\uff01");
				spweixin.setImageUrl(this.cookResult.getHead());
				spweixin.setUrl(new StringBuilder(Constant.COOK_SHARE_CONTENT).append(this.cookResult.getId())
						.toString());
				spweixin.setShareType(4);
				Platform weixin = ShareSDK.getPlatform(Wechat.NAME);
				weixin.setPlatformActionListener(this.paListener);
				weixin.share(spweixin);
			}
		case R.id.lLayout_share_to_wxpy /* 2131165624 */:
			if (this.cookResult != null) {
				this.dialogShare.dismiss();
				ShareParams spweixinf = new SinaWeibo.ShareParams();
				spweixinf
						.setTitle("\u5168\u57ce\u70ed\u7ea6\uff0c\u79c1\u53a8\u4e0a\u95e8\u505a\u996d\uff0169\u5143\u7ea6\u4e2a\u79c1\u53a8\u4e0a\u95e8\u505a\u996d\uff0c\u7a9d\u5728\u6c99\u53d1\u4e0a\u770b\u5b8c\u7535\u89c6\uff0c\u7f8e\u5473\u4f73\u80b4\u5c31\u4e0a\u684c\u5566\uff01");
				spweixinf.setImageUrl(this.cookResult.getHead());
				spweixinf.setUrl(new StringBuilder(Constant.COOK_SHARE_CONTENT).append(this.cookResult.getId())
						.toString());
				spweixinf.setShareType(4);
				Platform weixinf = ShareSDK.getPlatform(WechatMoments.NAME);
				weixinf.setPlatformActionListener(this.paListener);
				weixinf.share(spweixinf);
			}
		case R.id.lLayout_share_to_qq /* 2131165626 */:
			if (this.cookResult != null) {
				this.dialogShare.dismiss();
				SinaWeibo.ShareParams sp1 = new SinaWeibo.ShareParams();
				sp1.setTitle("\u7231\u5927\u53a8\u53a8\u5e08" + this.cookResult.getName());
				sp1.setTitleUrl(new StringBuilder(Constant.COOK_SHARE_CONTENT).append(this.cookResult.getId())
						.toString());
				sp1.setText("\u5168\u57ce\u70ed\u7ea6\uff0c\u79c1\u53a8\u4e0a\u95e8\u505a\u996d\uff0169\u5143\u7ea6\u4e2a\u79c1\u53a8\u4e0a\u95e8\u505a\u996d\uff0c\u7a9d\u5728\u6c99\u53d1\u4e0a\u770b\u5b8c\u7535\u89c6\uff0c\u7f8e\u5473\u4f73\u80b4\u5c31\u4e0a\u684c\u5566\uff01");
				sp1.setImageUrl(this.cookResult.getHead());
				sp1.setSite(getString(2131230803));
				sp1.setSiteUrl(new StringBuilder(Constant.COOK_SHARE_CONTENT).append(this.cookResult.getId())
						.toString());
				Platform qzone = ShareSDK.getPlatform(QZone.NAME);
				qzone.setPlatformActionListener(this.paListener);
				qzone.share(sp1);
			}
		case R.id.lLayout_share_to_sina /* 2131165628 */:
			if (this.cookResult != null) {
				this.dialogShare.dismiss();
				SinaWeibo.ShareParams sp = new SinaWeibo.ShareParams();
				sp.setText("\u5168\u57ce\u70ed\u7ea6\uff0c\u79c1\u53a8\u4e0a\u95e8\u505a\u996d\uff0169\u5143\u7ea6\u4e2a\u79c1\u53a8\u4e0a\u95e8\u505a\u996d\uff0c\u7a9d\u5728\u6c99\u53d1\u4e0a\u770b\u5b8c\u7535\u89c6\uff0c\u7f8e\u5473\u4f73\u80b4\u5c31\u4e0a\u684c\u5566\uff01http://www.idachu.cn/kitchener/view/"
						+ this.cookResult.getId() + "  @\u7231\u5927\u53a8");
				sp.setImageUrl(this.cookResult.getHead());
				Platform weibo = ShareSDK.getPlatform(SinaWeibo.NAME);
				weibo.setPlatformActionListener(this.paListener);
				weibo.share(sp);
			}
		case R.id.rLayout_head_dialog /* 2131165631 */:
			this.headCookDialog.dismiss();
		default:
		}
	}

	public void showLogin() {
		MainToast.show(this, "\u8bf7\u5148\u767b\u5f55", 0);
		startActivityForResult(new Intent(this, LoginActivity.class), this.LoginRequest);
	}

	@Override
	public void onActivityResult(int requestCode, int resultCode, Intent data) {
		super.onActivityResult(requestCode, resultCode, data);
		if (requestCode == this.LoginRequest && resultCode == -1) {
			this.img_collect.performClick();
		}
	}

	public Dialog createCookHeadDialog(Context context) {
		View view = LayoutInflater.from(context).inflate(R.layout.view_cookhead_dialog, null);
		int width = Utils.getScreenWidth(this);
		int height = Utils.getScreenHeight(this);
		view.setMinimumHeight(height);
		view.setMinimumWidth(width);
		View img_head_dialog = view.findViewById(R.id.img_head_dialog);
		img_head_dialog.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				CookDetailActivity.this.headCookDialog.dismiss();
			}
		});
		if (this.cookResult == null) {
			return null;
		}
		((TextView) view.findViewById(R.id.tv_name)).setText(this.cookResult.getName());
		((RelativeLayout) view.findViewById(R.id.rLayout_head_dialog)).setOnClickListener(this);
		this.bu.display(img_head_dialog, this.cookResult.getHead(),
				new AnonymousClass_10((RelativeLayout) view.findViewById(R.id.rLayout_head_dialog_progress)));
		Dialog dialog = new Dialog(context, 2131361805);
		dialog.setContentView(view);
		Window window = dialog.getWindow();
		LayoutParams wl = window.getAttributes();
		wl.width = width;
		wl.height = height;
		window.setAttributes(wl);
		dialog.setCanceledOnTouchOutside(true);
		return dialog;
	}

	private Dialog createBottomShareDialog() {
		View view = LayoutInflater.from(this).inflate(R.layout.view_bottom_dialog_share, null);
		view.setMinimumWidth(getWindowManager().getDefaultDisplay().getWidth());
		view.setMinimumHeight(getWindowManager().getDefaultDisplay().getHeight());
		((LinearLayout) view.findViewById(R.id.ll_anim)).startAnimation(AnimationUtils.loadAnimation(this,
				R.anim.dialog_share_content_in));
		((LinearLayout) view.findViewById(R.id.ll_dismiss)).setOnClickListener(this);
		((LinearLayout) view.findViewById(R.id.lLayout_share_to_qq)).setOnClickListener(this);
		((LinearLayout) view.findViewById(R.id.lLayout_share_to_sina)).setOnClickListener(this);
		((LinearLayout) view.findViewById(R.id.lLayout_share_to_weixin)).setOnClickListener(this);
		((LinearLayout) view.findViewById(R.id.lLayout_share_to_wxpy)).setOnClickListener(this);
		((TextView) view.findViewById(R.id.txt_share_sel_cancel)).setOnClickListener(this);
		Dialog dialog = new Dialog(this, 2131361803);
		dialog.setContentView(view);
		dialog.setCanceledOnTouchOutside(false);
		Window dialogWindow = dialog.getWindow();
		LayoutParams lp = dialogWindow.getAttributes();
		dialogWindow.setGravity(83);
		lp.x = 0;
		lp.y = 0;
		dialogWindow.setAttributes(lp);
		return dialog;
	}
}
